Crispo - Excel Challenge 40 2024

excel-challenges
weekly-exercises
Easy Sunday Excel Challenge
Published

October 6, 2024

Illustration for Crispo - Excel Challenge 40 2024

Challenge Description

Easy Sunday Excel Challenge

⭐ Staff PPE PPE REPORT Size Easy Sunday Excel Challenge Aiden

Solutions

library(tidyverse)
library(readxl)

path = "files/Excel Challenge October 6th.xlsx"
input1 = read_excel(path, range = "B2:C5") %>% mutate(id = 1)
input2 = read_excel(path, range = "E2:E6") %>% mutate(id = 1)
test  = read_excel(path, range = "G2:I14") 

result = input1 %>% 
  full_join(input2, by = "id") %>%
  select(Staff, PPE, Size)

all.equal(result, test)
# [1] TRUE
  • Logic:

    • Reads the workbook range needed for the challenge

    • Builds the intermediate helper columns that drive the final answer

  • Strengths:

    • The R solution stays compact and mirrors the workbook logic closely.
  • Areas for Improvement:

    • The code assumes the workbook layout and named ranges remain stable.
  • Gem:

    • The best part of the solution is choosing a tidy intermediate shape before producing the final answer.
import pandas as pd

path = "files/Excel Challenge October 6th.xlsx"

input1 = pd.read_excel(path, usecols="B:C", skiprows=1, nrows=3).assign(id=1)
input2 = pd.read_excel(path, usecols="E", skiprows=1, nrows=4).assign(id=1)
test = pd.read_excel(path, usecols="G:I", skiprows=1, nrows=13).rename(columns=lambda x: x.replace('.1', ''))
result = pd.merge(input1, input2, on="id", how="outer")[['Staff', 'PPE', 'Size']]
print(result.equals(test)) # True
  • Logic:

    • Reads the workbook range needed for the challenge

    • Builds the intermediate helper columns that drive the final answer

  • Strengths:

    • The Python version keeps the same rule in a direct pandas-oriented workflow.
  • Areas for Improvement:

    • As with the R version, any workbook layout change would require small adjustments.
  • Gem:

    • The implementation stays close to the stated challenge instead of adding unnecessary complexity.

Difficulty Level

This task is easy to moderate:

  • The business rule is readable, but the workbook still needs a few careful transformation steps.